Write a custom CUDA kernel to optimize `AQuLU`.

Formula:
  f(x) = x                         if x >= (1-beta)/alpha
       = alpha*x^2 + beta*x        if -beta/alpha <= x < (1-beta)/alpha
       = 0                         if x < -beta/alpha

Problem Analysis:
1. Memory Bound: This is a piecewise element-wise activation.
2. Operator Chaining: PyTorch implementation requires multiple `torch.where` calls.

Optimization Strategy: Fused Element-wise Kernel with Vectorization

1. One-Thread-per-Element: Map each element to a CUDA thread.

2. Vectorized Loads (float4): Use `float4` to process 128 bits per memory transaction.

3. Fused Branching Logic:
   - Pre-compute thresholds `thresh1 = -beta/alpha` and `thresh2 = (1-beta)/alpha` on the host.
   - Kernel logic: Use a nested `if-else` to handle the three segments.
   - All computations are fused in registers.

4. One-Pass: Fuse all steps into a single read-compute-write kernel.
  
Here's an example to show you the syntax of inline embedding custom CUDA operators in torch: The example given architecture is:   
  
```python
import torch
import torch.nn as nn

BATCH_SIZE = 4096
HIDDEN_DIM = 4096
SHAPE = (BATCH_SIZE, HIDDEN_DIM)

ALPHA_INIT = 0.5
BETA_INIT = 1.0

class AQuLU(nn.Module):
    '''
    The Adaptive Quadratic Linear Unit (AQuLU): Adaptive Non Monotonic Piecewise Activation Function
    https://hrcak.srce.hr/file/444170
    Formula:
      f(x) = x                         if x >= (1-beta)/alpha
           = alpha*x^2 + beta*x        if -beta/alpha <= x < (1-beta)/alpha
           = 0                         if x < -beta/alpha
    '''
    def __init__(self, alpha_init=0.5, beta_init=1.0):
        super(AQuLU, self).__init__()
        self.alpha = nn.Parameter(torch.tensor(alpha_init))
        self.beta = nn.Parameter(torch.tensor(beta_init))

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        thresh1 = -self.beta / self.alpha
        thresh2 = (1.0 - self.beta) / self.alpha
        
        part1 = x
        part2 = self.alpha * x.pow(2) + self.beta * x
        part3 = torch.zeros_like(x)
        
        res = torch.where(x >= thresh1, part2, part3)
        res = torch.where(x >= thresh2, part1, res)
        
        return res

class Model(nn.Module):
    def __init__(self, alpha_init=0.5, beta_init=1.0):
        super(Model, self).__init__()
        self.act = AQuLU(alpha_init, beta_init)
    
    def forward(self, x):
        return self.act(x)

def get_inputs():
    input_tensor = torch.randn(SHAPE, dtype=torch.float32)
    return [input_tensor.contiguous()]

def get_init_inputs():
    return [ALPHA_INIT, BETA_INIT]